package cn.edu.scau.cmi.wuyihan.exercise9.Example9_23;

import java.util.StringTokenizer;

public class GetToken {
   String s[];
   public String getToken(int index,String str){
	   StringTokenizer fenxi=new StringTokenizer(str);
	   int number=fenxi.countTokens();
	   s=new String[number+1];
	   int k=1;
	   while(fenxi.hasMoreTokens()) {
		   String temp=fenxi.nextToken();
		   s[k]=temp;
		   k++;
	   }
	   if(index<=number) {
		   return s[index];
		   
	   }
	   else {
		return null;
	}
   }
}
